﻿namespace FantomNext.Shared
{
    public struct Vector2I
    {
        public readonly int X;
        public readonly int Y;

        public Vector2I(int x, int y)
        {
            X = x;
            Y = y;
        }

        // 重载加法运算符
        public static Vector2I operator +(Vector2I v1, Vector2I v2)
        {
            return new Vector2I(v1.X + v2.X, v1.Y + v2.Y);
        }

        // 重载减法运算符
        public static Vector2I operator -(Vector2I v1, Vector2I v2)
        {
            return new Vector2I(v1.X - v2.X, v1.Y - v2.Y);
        }

        // 重载负号运算符
        public static Vector2I operator -(Vector2I v)
        {
            return new Vector2I(-v.X, -v.Y);
        }

        // 重载乘法运算符（向量与标量相乘）
        public static Vector2I operator *(Vector2I v, int scalar)
        {
            return new Vector2I(v.X * scalar, v.Y * scalar);
        }

        // 重载乘法运算符（标量与向量相乘）
        public static Vector2I operator *(int scalar, Vector2I v)
        {
            return v * scalar;
        }

      

        // 重写 ToString 方法
        public override string ToString()
        {
            return $"({X}, {Y})";
        }
    }
}
